package com.itheima.HomeWork;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Demo03 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<String> list2= new ArrayList<>();
        Collections.addAll(list1,"财困困，24","叶后弦，23","六部天，22","五千，24","股价，30","葵按量，27");
        Collections.addAll(list2,"找效应，35","杨颖，36","高圆圆，43","张甜甜，31","六十，35","杨晓英，33");
        Stream<String> limit3 = list1.stream().filter(s -> s.split("，")[0].length() == 3).limit(2);
        System.out.println("---------------------------------------");
        Stream<String> limit4 = list2.stream().filter(s -> s.split("，")[0].startsWith("杨")).skip(1);
        System.out.println("---------------------------------------");
//        Stream<String> concat = Stream.concat(limit3, limit4);
//        concat.forEach(s -> System.out.println(s));
        System.out.println("---------------------------------------");
        List<Demo33> collect = Stream.concat(limit3, limit4)
                .map(s -> new Demo33(s.split("，")[0], Integer.parseInt(s.split("，")[1])))
                .collect(Collectors.toList());
        System.out.println(collect);
        System.out.println("---------------------------------------");


    }
}
